﻿#region Using Directives

using System;
using System.Diagnostics;
using System.IO;

#endregion Using Directives


namespace Kongo
{
    internal class Literal : Node
    {
        #region Fields

        private string source;
        private int startIndex;
        private int length;

        #endregion Fields


        #region Methods

        public override void Render(Context context, TextWriter output)
        {
            // Write the literal portion of the template
            output.Write(source.Substring(startIndex, length));
        }

        #endregion Methods


        #region Constructors

        public Literal(string source, int startIndex, int length)
        {
            Debug.Assert(source != null, "The 'source' argument was null.");
            Debug.Assert(startIndex >= 0, "The 'startIndex' argument was less than zero.");
            Debug.Assert(startIndex + length <= source.Length, "The 'length' argument was out of range.");

            this.source = source;
            this.startIndex = startIndex;
            this.length = length;
        }

        #endregion Constructors
    }
}
